package cn.itcast.com.Collection;

import java.util.ArrayList;
import java.util.Iterator;

public class demo2 {
    public static void main(String[] args) {
        ArrayList c = new ArrayList();
        c.add("a");
        c.add("b");
        c.add("c");
        //使用集合的api使得集合的结构发生变化，那么iterator就会抛出异常
        Iterator iterator = c.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
    }
}
